/*********************************************************************
*
*   MODULE NAME:
*       vts_gm862_gps.h - Header File For GM862-GPS
*
*   DESCRIPTION:
*       Header File For GM862-GPS
*
* Copyright 2011 by KU onTime
*---------------------------------------------------------------------
* Version: 1.1 - Minor changes to data type names
* Version: 1.0 - Initial development
*
*********************************************************************/

#ifndef vts_gm862_gps_h
#define vts_gm862_gps_h

/*--------------------------------------------------------------------
                            GENERAL INCLUDES
--------------------------------------------------------------------*/
#include "WProgram.h"

/*--------------------------------------------------------------------
                            LITERAL CONSTANTS
--------------------------------------------------------------------*/

/*--------------------------------------------------------------------
                                 TYPES
--------------------------------------------------------------------*/

typedef struct 						/* GM862-GPS Data Type			*/
	{
	int 	timestamp; 				/* Time in UTC (HHMMSS) 		*/
	boolean valid;					/* Valid Signal 				*/
	float	latitude;				/* Latitude 					*/
	char	direction_ns;			/* Direction (N/S) 				*/	
	float	longitude; 				/* Longitude 					*/	
	char	direction_ew;			/* Direction (E/W) 				*/	
	float	spd;					/* Speed in Knots 				*/	
	float	directn;				/* Direction in Degrees 		*/	
	int		date;					/* Date in UTC (DDMMYY)			*/	
	char 	mode;					/* Mode Indicator 				*/	
	int		checksum;				/* Error Check 					*/	
	} vts_gps_data_type;
   
enum vts_gm862_gps_status_t8		/* GM862-GPS Status         	*/
    {
    vts_GM862_OFF,
    vts_GM862_ON,
    vts_GM862_INITIALIZED,
    };
            
class vts_GM862_GPS 
{
	public:

		vts_GM862_GPS				/* GM862-GPS Constructor		*/
			( 
			HardwareSerial *serial_port_i, 	
									/* hardware serial port			*/
			uint16_t power_pin, 	/* hardware power pin			*/
			uint16_t power_sense_pin/* hardware power sense pin		*/
			);
		
		void Power_On				/* Power On GM862-GPS Module	*/
			( void );
			
		void Power_Off				/* Power Off GM862-GPS Module	*/
			( void );
			
		void Initialize				/* Initialize GM862-GPS	Module	*/
			( void );
			
		void Version_Info			/* Display Hardware Version		*/
			( void );
		
	private:

		void send_command			/* Send Command To GM862-GPS	*/
			( 
			const String command 	/* command to send				*/
            );
			
		vts_gm862_gps_status_t8	
							state;	/* GM862-GPS Status				*/
		vts_gps_data_type	gps_position;
									/* GM862-GPS NMEA Data			*/
		uint16_t			power_pin;
									/* GM862-GPS Power Pin			*/
		uint16_t			power_sense_pin;
									/* GM862-GPS Power Sense Pin	*/
		HardwareSerial 		*serial_port;
									/* Serial Interface				*/
	
};

/*--------------------------------------------------------------------
                           PROJECT INCLUDES
--------------------------------------------------------------------*/

/*--------------------------------------------------------------------
                            MEMORY CONSTANTS
--------------------------------------------------------------------*/

/*--------------------------------------------------------------------
                               VARIABLES
--------------------------------------------------------------------*/

/*--------------------------------------------------------------------
                                 MACROS
--------------------------------------------------------------------*/

/*--------------------------------------------------------------------
                              PROCEDURES
--------------------------------------------------------------------*/

#endif
